package com.nexfra.bbssys.adm.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class AdmBoardMngrDao {
	@Autowired
	private SqlSession sqlSession;

	/**
	 * 게시판목록을 조회한다.
	 * @param  sqlParams 파라미터맵  
	 * @return List<Map<String,Object>>
	 */
	public List<Map<String,Object>> selectBoardList(HashMap<String, String> sqlParams)
			throws Exception {		
		return sqlSession.selectList("AdmBoardMngrSqlMap.selectBoardList", sqlParams);
	}	
	
	/**
	 * 게시판을 조회한다.
	 * @param  sqlParams 파라미터맵  
	 * @return Map<String,Object>
	 */
	public Map<String,Object> selectBoardOne(HashMap<String, String> sqlParams)
	        throws Exception {
		return sqlSession.selectOne("AdmBoardMngrSqlMap.selectBoardOne", sqlParams);
	}	
	
	/**
	 * bbs_id 시퀀스 채번
	 * @param sqlParams
	 */
	public String selectSeqBBSId(HashMap<String, String> sqlParams) 
			throws Exception {	
		return sqlSession.selectOne("AdmBoardMngrSqlMap.selectSeqBBSId", sqlParams);
	}	
	
	/**
	 * 게시판을 등록한다.
	 * @param  sqlParams 파라미터맵
	 * @return void
	 */ 
	public void insertBBSMaster(HashMap<String, String> sqlParams)
			throws Exception {		
		sqlSession.insert("AdmBoardMngrSqlMap.insertBBSMaster", sqlParams);
	}		
	
	/**
	 * 게시판을 수정한다.
	 * @param  sqlParams 파라미터맵
	 * @return void
	 */ 
	public void updateBBSMaster(HashMap<String, String> sqlParams)
			throws Exception {		
		sqlSession.update("AdmBoardMngrSqlMap.updateBBSMaster", sqlParams);
	}		
	
	/**
	 * 게시판을 삭제한다.
	 * @param  sqlParams 파라미터맵
	 * @return void
	 */ 
	public void deleteBBSMaster(HashMap<String, String> sqlParams)
			throws Exception {		
		sqlSession.update("AdmBoardMngrSqlMap.deleteBBSMaster", sqlParams);
	}		
}
